document.write('<link rel="stylesheet" href="../css/showInformation.css">');
$(function (){
    $('#selected0').on('mouseover',function (){
        let datas = {"Id":"56"}
        $.post('/catalog/showInformation?categoryId='+document.getElementById("selected0").getAttribute("alt"),datas,function (data) {
            if(data.code===8){
                console.log(data.msg);
                var inform = document.getElementById("information");
                inform.innerText = data.msg;
                inform.style.position = "absolute";
                inform.style.display = "block";
                inform.style.left = "900px";
                inform.style.top = "200px";
                inform.style.lineHeight = "20px"
            }
        });
    });
    $('#selected1').on('mouseover',function (){
        let datas = {"Id":"56"}
        $.post('/catalog/showInformation?categoryId='+document.getElementById("selected1").getAttribute("alt"),datas,function (data) {
            if(data.code===8){
                console.log(data.msg);
                var inform = document.getElementById("information");
                inform.innerText = data.msg;
                inform.style.position = "absolute";
                inform.style.display = "block";
                inform.style.left = "550px";
                inform.style.top = "460px";
                inform.style.lineHeight = "20px"
            }
        });
    });
    $('#selected2').on('mouseover',function (){
        let datas = {"Id":"56"}
        $.post('/catalog/showInformation?categoryId='+document.getElementById("selected2").getAttribute("alt"),datas,function (data) {
            if(data.code===8){
                console.log(data.msg);
                var inform = document.getElementById("information");
                inform.innerText = data.msg;
                inform.style.position = "absolute";
                inform.style.display = "block";
                inform.style.left = "650px";
                inform.style.top = "500px";
                inform.style.lineHeight = "20px"
            }
        });
    });
    $('#selected3').on('mouseover',function (){
        let datas = {"Id":"56"}
        $.post('/catalog/showInformation?categoryId='+document.getElementById("selected3").getAttribute("alt"),datas,function (data) {
            if(data.code===8){
                console.log(data.msg);
                var inform = document.getElementById("information");
                inform.innerText = data.msg;
                inform.style.position = "absolute";
                inform.style.display = "block";
                inform.style.left = "700px";
                inform.style.top = "550px";
                inform.style.lineHeight = "20px"
            }
        });
    });
    $('#selected4').on('mouseover',function (){
        let datas = {"Id":"56"}
        $.post('/catalog/showInformation?categoryId='+document.getElementById("selected4").getAttribute("alt"),datas,function (data) {
            if(data.code===8){
                console.log(data.msg);
                var inform = document.getElementById("information");
                inform.innerText = data.msg;
                inform.style.position = "absolute";
                inform.style.display = "block";
                inform.style.left = "800px";
                inform.style.top = "550px";
                inform.style.lineHeight = "20px"
            }
        });
    });
    $('#selected5').on('mouseover',function (){
        let datas = {"Id":"56"}
        $.post('/catalog/showInformation?categoryId='+document.getElementById("selected5").getAttribute("alt"),datas,function (data) {
            if(data.code===8){
                console.log(data.msg);
                var inform = document.getElementById("information");
                inform.innerText = data.msg;
                inform.style.position = "absolute";
                inform.style.display = "block";
                inform.style.left = "900px";
                inform.style.top = "450px";
                inform.style.lineHeight = "20px"
            }
        });
    });
    $(document.getElementsByName("estoremap")).on('mouseout',function (){
        var informDiv = document.getElementById('information');
        var x=event.clientX;
        var y=event.clientY;
        var divx1 = informDiv.offsetLeft;
        var divy1 = informDiv.offsetTop;
        var divx2 = informDiv.offsetLeft + informDiv.offsetWidth;
        var divy2 = informDiv.offsetTop + informDiv.offsetHeight;
        if( x < divx1 || x > divx2 || y < divy1 || y > divy2){
            document.getElementById('information').style.display='none';
        }
    });
});
//------------------------------------------------
window.onload = function(){
    var box1=this.document.getElementsByClassName("re1")[0];
    var lik1=box1.getElementsByTagName("li");
    var box2=this.document.getElementsByClassName("re2")[0];
    var lik2=box2.getElementsByTagName("li");
    var box3=this.document.getElementsByClassName("re3")[0];
    var lik3=box3.getElementsByTagName("li");
    var box4=this.document.getElementsByClassName("re4")[0];
    var lik4=box4.getElementsByTagName("li");
    var box5=this.document.getElementsByClassName("re5")[0];
    var lik5=box5.getElementsByTagName("li");
    function fun1(i,j){//转换图片函数，就是把透明度改了一下
        lik1[i].style.opacity=1;
        lik1[j].style.opacity=0;
    }
    function fun2(i,j){//转换图片函数，就是把透明度改了一下
        lik2[i].style.opacity=1;
        lik2[j].style.opacity=0;
    }
    function fun3(i,j){//转换图片函数，就是把透明度改了一下
        lik3[i].style.opacity=1;
        lik3[j].style.opacity=0;
    }
    function fun4(i,j){//转换图片函数，就是把透明度改了一下
        lik4[i].style.opacity=1;
        lik4[j].style.opacity=0;
    }
    function fun5(i,j){//转换图片函数，就是把透明度改了一下
        lik5[i].style.opacity=1;
        lik5[j].style.opacity=0;
    }
    fun1(0,1);//初始化下
    fun2(0,1);
    fun3(0,1);
    fun4(0,1);
    fun5(0,1);
    var i =0;
    var j = 0;
    var k = 0;
    var l = 0;
    var m = 0;

    function auto(){//轮播循环函数
        i++;
        j++;
        k++;
        l++;
        m++;
        if(i>=4){
            i=0;
            fun1(0,3);
        }
        else {
            fun1(i,i-1);
        }
        if (j>=6){
            j = 0;
            fun2(0,5);
        }
        else {
            fun2(j,j-1);
        }
        if(k>=2){
            k=0;
            fun3(0,1);
        }
        else {
            fun3(k,k-1);
        }
        if(l>=2){
            l=0;
            fun4(0,1);
        }
        else {
            fun4(l,l-1);
        }
        if(m>=2){
            m=0;
            fun5(0,1);
        }
        else {
            fun5(m,m-1);
        }
    }
    timer=this.setInterval(auto,3000);
}